<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="iso-8859-1" %>
<%--@elvariable id="command" type="com.google.code.sms.command.MediaFolderSettingsCommand"--%>

<html><head>
        <%@ include file="head.jsp" %>
        <%@ include file="jquery.jsp" %>
    </head>
    <body class="mainframe bgcolor1">

        <c:import url="settingsHeader.jsp">
            <c:param name="cat" value="mediaFolder"/>
            <c:param name="toast" value="${command.reload}"/>
        </c:import>

        <form:form commandName="command" action="mediaFolderSettings.view" method="post">

            <table class="indent">
                <tr>
                    <th><fmt:message key="mediafoldersettings.name"/></th>
                    <th><fmt:message key="mediafoldersettings.path"/></th>
                    <th style="padding-left:1em"><fmt:message key="mediafoldersettings.enabled"/></th>
                    <th style="padding-left:1em"><fmt:message key="common.delete"/></th>
                    <th></th>
                </tr>

                <c:forEach items="${command.mediaFolders}" var="folder" varStatus="loopStatus">
                    <tr>
                        <td><form:input path="mediaFolders[${loopStatus.count-1}].name" size="20"/></td>
                        <td><form:input path="mediaFolders[${loopStatus.count-1}].path" size="40"/></td>
                        <td align="center" style="padding-left:1em"><form:checkbox path="mediaFolders[${loopStatus.count-1}].enabled" cssClass="checkbox"/></td>
                        <td align="center" style="padding-left:1em"><form:checkbox path="mediaFolders[${loopStatus.count-1}].delete" cssClass="checkbox"/></td>
                        <td><c:if test="${not folder.existing}"><span class="warning"><fmt:message key="mediafoldersettings.notfound"/></span></c:if></td>
                        </tr>
                </c:forEach>

                <tr>
                    <th colspan="4" align="left" style="padding-top:1em"><fmt:message key="mediafoldersettings.add"/></th>
                </tr>

                <tr>
                    <td><form:input path="newMediaFolder.name" size="20"/></td>
                    <td><form:input path="newMediaFolder.path" size="40"/></td>
                    <td align="center" style="padding-left:1em"><form:checkbox path="newMediaFolder.enabled" cssClass="checkbox"/></td>
                    <td></td>
                </tr>

            </table>

            <p class="forward"><a href="mediaFolderSettings.view?scanNow"><fmt:message key="mediafoldersettings.scannow"/></a></p>

            <c:if test="${command.scanning}">
                <p style="width:60%"><b><fmt:message key="mediafoldersettings.nowscanning"/></b></p>
            </c:if>

            <p class="forward"><a href="mediaFolderSettings.view?expunge"><fmt:message key="mediafoldersettings.expunge"/></a></p>
            <p class="detail" style="width:60%;white-space:normal;margin-top:-10px;">
                <fmt:message key="mediafoldersettings.expunge.description"/>
            </p>
            
            <p class="forward"><a href="mediaFolderSettings.view?removeAll"><fmt:message key="mediafoldersettings.removeall"/></a></p>

            <%--<div>--%>
            <%--<form:checkbox path="organizeByFolderStructure" cssClass="checkbox" id="organizeByFolderStructure"/>--%>
            <%--<form:label path="organizeByFolderStructure"><fmt:message key="mediafoldersettings.organizebyfolderstructure"/></form:label>--%>
            <%--</div>--%>

            <%--<p class="detail" style="width:60%;white-space:normal;">--%>
            <%--<fmt:message key="mediafoldersettings.organizebyfolderstructure.description"/>--%>
            <%--</p>--%>

            <p >
                <input type="submit" value="<fmt:message key="common.save"/>" style="margin-right:0.3em">
                <input type="button" value="<fmt:message key="common.cancel"/>" onclick="location.href = 'nowPlaying.view'">
            </p>

        </form:form>

        <c:if test="${command.reload}">
            <script type="text/javascript">
                    parent.frames.upper.location.href = "top.view?";
                    parent.frames.left.location.href = "left.view?";
                    parent.frames.right.location.href = "right.view?";
            </script>
        </c:if>

    </body></html>